<template>
  <div>
    Home组件--{{ num }}
    <br>
    <br>
    <button @click="incCount">执行vuex里面的方法</button>
    <br>
    <hr>
    <br><br>
    <ul>
      <li v-for="(item, index) in $store.state.list" :key="index">

        {{ item }}
      </li>
    </ul>
    <br>
    <br>
    获取getters里面的数据--{{ revMsg }}

    <br>
    获取getters里面的数据--{{ num }}
  </div>
</template>

<script>

import { defineComponent } from 'vue';

export default defineComponent({
  data() {
    return {

    }
  }, methods: {
    incCount() {
      //触发了mutations
      this.$store.commit('incCount')
    }
  },
  computed: {
    num() {
      return this.$store.state.count
    },
    revMsg() {
      return this.$store.getters.reverseMsg
    },
    num() {
      return this.$store.getters.num
    }
  }

})
</script>

<style lang="scss"></style>